#
# Tic-Tac-Toe - Turn-based strategy game
# Copyright 2008, 2009 Shayne Riley and Paul Maseberg
#
# Tic-Tac-Toe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tic-Tac-Toe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tic-Tac-Toe.  If not, see <http://www.gnu.org/licenses/>
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# To contact the authors on questions or issues regarding the license,
# you may send an email to <shayner at gmail dot com>


# Name of the Project.
project(TicTacToe CXX)

cmake_minimum_required(VERSION 2.6)

option(TEST_BUILD "Turn on to build text binaries" OFF)

# Use very strict warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0 -g3 -pedantic -Wall -ansi -Wconversion -Wshadow -Wcast-qual -Wwrite-strings")

# Create a new build type
# For profiling with gprof.
set(CMAKE_CXX_FLAGS_PROFILE "-pg -O0")
# For coverage profiling with gcov
set(CMAKE_CXX_FLAGS_COVERAGE "-ftest-coverage -fprofile-arcs -O0")

# Set the build type options are
# -None ()
# -Debug (-g)
# -Release
# -RelWithDebInfo (-O2 -g)
# -MinSizeRel
# Or any custom type.
# This can be overwritten with -D when using cmake.
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE release)
endif(NOT CMAKE_BUILD_TYPE)

# See more output from the build.
if(NOT CMAKE_VERBOSE_MAKEFILE)
    set(CMAKE_VERBOSE_MAKEFILE OFF)
endif(NOT CMAKE_VERBOSE_MAKEFILE)

# Used to make libraries shared.
set(BUILD_SHARED_LIBS ON)

# Put the executables in the bin folder
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})

link_directories(/usr/lib)
include_directories(/usr/include/freetype2/)
add_executable(TicTacToeGame 
    main.cpp
    GameBoard.cpp
    Graphics.cpp
    Audio.cpp
    BoardDisplay.cpp
    Button.cpp
    TitleScreen.cpp
    MenuButton.cpp)

target_link_libraries(TicTacToeGame SDL SDL_mixer SDL_image GL GLU ftgl)

if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
     add_custom_command(
     OUTPUT ${CMAKE_BINARY_DIR}/res
     COMMAND ${CMAKE_COMMAND} -E copy_directory
     ${CMAKE_SOURCE_DIR}/../res ${CMAKE_BINARY_DIR}/res
     )
     add_custom_target( ResourceFiles ALL DEPENDS ${CMAKE_BINARY_DIR}/res)
endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")


#install(FILES ${files} DESTINATION bin)Z
install(DIRECTORY ../res/ DESTINATION bin/res
    PATTERN ".svn" EXCLUDE)


install(TARGETS TicTacToeGame RUNTIME DESTINATION bin)

set(CPACK_PACKAGE_NAME "TicTacToe")
set(CPACK_PACKAGE_VERSION 0.1.0)
set(CPACK_PACKAGE_VENDOR "pezad")
set(CPACK_PACKAGE_DESCRIPION_SUMMARY "A simple Tic-Tac-Toe game")
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "") #SDL
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Paul Maseberg")
include(CPack)



